package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TNucleateResidentTaskMapper;
import com.ruoyi.system.domain.TNucleateResidentTask;
import com.ruoyi.system.service.ITNucleateResidentTaskService;

/**
 * 核酸住户任务Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-10-16
 */
@Slf4j
@Service
public class TNucleateResidentTaskServiceImpl implements ITNucleateResidentTaskService 
{
    @Autowired
    private TNucleateResidentTaskMapper tNucleateResidentTaskMapper;

    /**
     * 查询核酸住户任务
     * 
     * @param id 核酸住户任务主键
     * @return 核酸住户任务
     */
    @Override
    public TNucleateResidentTask selectTNucleateResidentTaskById(Long id)
    {
        return tNucleateResidentTaskMapper.selectTNucleateResidentTaskById(id);
    }

    /**
     * 查询核酸住户任务列表
     * 
     * @param tNucleateResidentTask 核酸住户任务
     * @return 核酸住户任务
     */
    @Override
    public List<TNucleateResidentTask> selectTNucleateResidentTaskList(TNucleateResidentTask tNucleateResidentTask)
    {
        return tNucleateResidentTaskMapper.selectTNucleateResidentTaskList(tNucleateResidentTask);
    }

    /**
     * 新增核酸住户任务
     * 
     * @param tNucleateResidentTask 核酸住户任务
     * @return 结果
     */
    @Override
    public int insertTNucleateResidentTask(TNucleateResidentTask tNucleateResidentTask)
    {
        return tNucleateResidentTaskMapper.insertTNucleateResidentTask(tNucleateResidentTask);
    }

    /**
     * 修改核酸住户任务
     * 
     * @param tNucleateResidentTask 核酸住户任务
     * @return 结果
     */
    @Override
    public int updateTNucleateResidentTask(TNucleateResidentTask tNucleateResidentTask)
    {
        return tNucleateResidentTaskMapper.updateTNucleateResidentTask(tNucleateResidentTask);
    }

    /**
     * 批量删除核酸住户任务
     * 
     * @param ids 需要删除的核酸住户任务主键
     * @return 结果
     */
    @Override
    public int deleteTNucleateResidentTaskByIds(Long[] ids)
    {
        return tNucleateResidentTaskMapper.deleteTNucleateResidentTaskByIds(ids);
    }

    /**
     * 删除核酸住户任务信息
     * 
     * @param id 核酸住户任务主键
     * @return 结果
     */
    @Override
    public int deleteTNucleateResidentTaskById(Long id)
    {
        return tNucleateResidentTaskMapper.deleteTNucleateResidentTaskById(id);
    }

    // 短信消息
    @Override
    public AjaxResult sendMsg(Long id) {
        TNucleateResidentTask tNucleateResidentTask = tNucleateResidentTaskMapper.selectTNucleateResidentTaskById(id);
        log.info("您的核酸任务将于" + tNucleateResidentTask.getStartTime() + "开始,请尽快去做核酸！");
        return AjaxResult.success();
    }
}
